package com.yunchao.bank.main.data.model

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "dispatch_tasks")
data class DispatchTaskEntity(

    @PrimaryKey(autoGenerate = true)
    val id: Long = 0,

    @ColumnInfo(name = "task_id")
    val taskId: Int,

    @ColumnInfo(name = "is_offline")
    val isOffline: Boolean,

    @ColumnInfo(name = "timestamp")
    val timestamp: Long,

    @ColumnInfo(name = "data_path")  // 改为存储文件路径
    val dataPath: String?,

    @ColumnInfo(name = "status")  // 0-未执行, 1-执行中, 2-已完成
    val status: Int = STATUS_NOT_EXECUTED,

    @ColumnInfo(name = "crate_time")  // 创建时间
    val createTime: Long = System.currentTimeMillis(),
) {
    companion object {
        // 定义存储离线文件的目录名称
        const val OFFLINE_TASK_DIR = "offline_tasks"

        // 0-未执行, 1-执行中, 2-已完成
        const val STATUS_NOT_EXECUTED = 0
        const val STATUS_EXECUTING = 1
        const val STATUS_COMPLETED = 2
    }
}
